using System;
using System.Windows;
using Microsoft.Practices.Prism.MefExtensions;
using Shell.View;
using Microsoft.Practices.ServiceLocation;
using Microsoft.Practices.Prism.Modularity;
using System.ComponentModel.Composition.Hosting;

namespace Shell
{
    public partial class Bootstrapper : MefBootstrapper
    {

        protected override void ConfigureAggregateCatalog()
        {
            base.ConfigureAggregateCatalog();
            this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(ShellView).Assembly));
        }

        protected override void InitializeShell()
        {
            Application.Current.RootVisual = this.Shell as UIElement;
        }

        protected override IModuleCatalog CreateModuleCatalog()
        {
            return Microsoft.Practices.Prism.Modularity.ModuleCatalog.CreateFromXaml(new Uri(
            "/Shell;component/ModuleCatalog.xaml",
            UriKind.Relative));
        }

        protected override DependencyObject CreateShell()
        {
            return ServiceLocator.Current.GetInstance<ShellView>();
        }
    }
}
